class WeatherViewController: NSViewController {

    @IBOutlet private weak var weatherView: WeatherView!

    override func viewDidLoad() {
        super.viewDidLoad()
        
        NotificationCenter.default.addObserver(self,
                                               selector:#selector(preferencesDidUpdate),
                                               name:NSNotification.Name(rawValue:"PreferencesUpdated"),
                                               object:nil)

        setupInitialWeatherData()
    }

    @objc private func preferencesDidUpdate() {
        updateWeatherDisplay()
    }
    
    private func updateWeatherDisplay(){
         self.weatherView.cityTextField.stringValue = getCurrentCityName()
         // 更改其他相关控件的状态...
     }
}